﻿import QtQuick 2.0

import QtQuick.Window 2.12
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4 as Old
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

import "../components"

Item {
    id:root

    signal accept()
    signal reject()

    onVisibleChanged: {
        if(!visible) visible = false
    }

    anchors.fill: parent
    Rectangle{
        anchors.fill: parent
        color: "#111111"
        opacity: 0.09
    }MouseArea{
        anchors.fill: parent
        onReleased: {
            root.focus = true
        }
    }

    Rectangle{
        radius: 15
        width: 405*dp
        height: 460*dp
        anchors.centerIn: parent
        anchors.verticalCenterOffset:  -50
        Text {
            x: 20*dp
            y: 18*dp
            text: "筛选"
            font.pixelSize: config.fontsize
        }
        Item{
            width: 20*dp
            height: 20*dp
            x: parent.width - 40*dp
            y: 18*dp
            Text{ text: "X" }
            MouseArea{
                cursorShape: Qt.PointingHandCursor
                anchors.fill: parent
                onReleased: { root.visible = false }
            }
        }
        Column{
            spacing: 20*dp
            x: 50*dp
            y: 65*dp
            CustomComboBox{
                id: combo1
                title: "基因分析仪"
                textWidth: 85*dp
                editWidth: 220*dp
                model: CSetUp.jyname()
            }CustomComboBox{
                id: combo2
                title: "试剂盒类型"
                textWidth: 85*dp
                editWidth: 220*dp
                model: CSetUp.sjhtypename()
                onCurrentText: {
                    combo3.model=CSetUp.sjhmcname(getText())
                }
            }CustomComboBox{
                id: combo3
                title: "试剂盒名称"
                textWidth: 85*dp
                editWidth: 220*dp
                model: ["全部"]
            }CustomComboBox{
                id: combo4
                title: "体系(μl)"
                textWidth: 85*dp
                editWidth: 220*dp
                showListMaxCountinPage: 3
                model: CSetUp.txname()
            }Row{
                height: 40*dp
                Text{
                    anchors.verticalCenter: parent.verticalCenter
                    text: "创建时间"
                    font.pixelSize: config.fontsize
                    width: 85*dp
                }
                CustomCalendarLine{
                    id: sttime
                    date: new Date(2024, 0, 1)
                    editWidth: 100*dp
                }
                Text{
                    anchors.verticalCenter: parent.verticalCenter
                    text: "  -"
                    font.pixelSize: config.fontsize
                    width: 20*dp
                }
                CustomCalendarLine{
                    id: endtime
                    date: new Date()
                    editWidth: 100*dp
                }
            }
            z: 1
        }
//        Row{
//            x: 50*dp
//            y: 290*dp
//            width: root.width
//            height: 40*dp
//            spacing: 10*dp
//            Text {
//                text: "创建时间"
//            }TextField {
//                id:sttime
//                width: 100*dp
//                placeholderText: "2024-01-01"
//                validator: RegExpValidator {
//                    regExp: /^\d{4}-\d{2}-\d{2}$/
//                }
//            }Text {
//                text: "-"
//                width:10*dp
//            }TextField {
//                id:endtime
//                width: 100*dp
//                placeholderText: "2024-12-31"
//                validator: RegExpValidator {
//                    regExp: /^\d{4}-\d{2}-\d{2}$/
//                }
//            }
//        }

        Item{
            y: parent.height - 90*dp
            width: parent.width
            PushButton{
                title: "取消"
                x: parent.width / 2 - 130*dp
                defaultMode2: true
                onReleased: {
                    root.visible = false
                }
            }PushButton{
                title: "确定"
                x: parent.width / 2 + 10*dp
                defaultMode1: true
                onReleased: {
                    settingsModel.ruleInfo = {
                        "Jyfxy":          combo1.getText(),
                        "ReagentKitType": combo2.getText(),
                        "ReagentKitName": combo3.getText(),
                        "System":         combo4.getText(),
                        "starttime":      sttime.getText(),
                        "endtime":        endtime.getText()
                    }
                    settingsModel.refresh()
                    root.visible = false
                }
            }
        }

    }

}
